package com.ruoyi.web.controller.dp;


import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.dp.domain.DpDangerousPoint;
import com.ruoyi.dp.domain.DpFleetSituation;
import com.ruoyi.dp.service.IDpFleetSituationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(description="机队整体情况")
@RestController
@RequestMapping("/dp/fleetSituation")
public class DpFleetSituationController extends BaseController {

    @Autowired
    IDpFleetSituationService dpFleetSituationService;

    @ApiOperation("机队整体情况列表")
    @GetMapping("/list")
    public TableDataInfo list(DpFleetSituation dpFleetSituation){
        startPage();
        List<DpFleetSituation> list=dpFleetSituationService.selectDpFleetSituationList(dpFleetSituation);
        return getDataTable(list);
    }

    @ApiOperation("获取机队整体情况详细信息")
    @GetMapping(value = "/{ID}")
    public AjaxResult getInfo(@PathVariable("ID") Long ID) {
        DpFleetSituation dpFleetSituation = dpFleetSituationService.selectDpFleetSituationById(ID);
        return success (dpFleetSituation);
    }

    @ApiOperation("新增机队整体情况")
    @Log(title = "机队整体情况", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DpFleetSituation dpFleetSituation) {
        return toAjax(dpFleetSituationService.insertDpFleetSituation(dpFleetSituation));
    }

    @ApiOperation(value = "修改机队整体情况")
    @Log(title = "机队整体情况", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DpFleetSituation dpFleetSituation)
    {
        return toAjax(dpFleetSituationService.updateDpFleetSituation(dpFleetSituation));
    }

    /**
     * 删除机队整体情况
     */
    @ApiOperation(value = "删除机队整体情况")
    @Log(title = "机队整体情况", businessType = BusinessType.DELETE)
    @DeleteMapping("/{IDs}")
    public AjaxResult remove(@PathVariable Long[] IDs)
    {
        return toAjax(dpFleetSituationService.deleteDpFleetSituationByIds(IDs));
    }
}
